// Move.h
//
// Created By: Jeremy Butler
// Created On: 21-Mar-2011
//
// A representation of a move in a chess game.

#ifndef MOVE_H
#define MOVE_H

#include "Piece.h"

#include <string>

using namespace std;

class Move{
private:
  Piece * fromPiece;
  Location fromLocation;
  Piece * toPiece;
  Location toLocation;
  Piece * takenPiece;
  
public:
  //! @brief No-Arg Contructor
  Move();

  //! @brief constructor
  //! @param _fromPiece the piece before the move.
  //! @param _fromRow the row of the piece before the move.
  //! @param _fromCol the column of the piece before the move.
  //! @param _toPiece the piece after the move;
  //! @param _toRow the row of the piece after the move.
  //! @param _toCol the column of the piece after the move.
  Move(const Piece & _fromPiece, int _fromRow, int _fromCol,
       const Piece * _toPiece, int _toRow, int _toCol,
       const Piece * _takenPiece);

  //! @brief Copy Constructor
  //! @param other The Move to be copied.
  Move(const Move & other);

  //! @brief Destructor
  virtual ~Move();

  //! @brief Operator = used to copy a Move to this one.
  //! @param other The Move to be copied.
  //! @return a reference to the newly copied Move.
  Move & operator = (const Move & other);

  //! @brief Get the Piece before it was moved
  //! @return a pointer to the Piece before it was moved or NULL if the move has not been initialized.
  const Piece * GetFromPiece() const;

  //! @brief Get the Piece after it was moved
  //! @return a pointer to the Piece after it was moved or NULL if the move was not initialized
  const Piece * GetToPiece() const;

  //! @brief Get the Piece after it was moved
  //! @return a pointer to the Piece that was taken during this move,
  //! 	or NULL if no piece was taken.
  const Piece * GetTakenPiece() const;

  //! @brief Get the Location of the Piece before it was moved.
  //! @return a reference to the Location of the Piece before it was moved.
  //!	the Location will be (-1,-1) if the move was unitialized
  const Location & GetFromLocation() const;

  //! @brief Get the Location of the Piece after it was moved.
  //! @return a reference to the Location of the Piece after it was moved.
  //!	the Location will be (-1,-1) if the move was unitialized
  const Location & GetToLocation() const;

  //! @brief A string representation of this object.
  //! @return a string representation of this object.
  string ToString() const;

private:
  void Clear();
  
};

#endif /* MOVE_H */
